mkdir -p /work/docker/mysql/conf
mkdir -p /work/docker/mysql/data
mkdir -p /work/docker/mysql/log

curl -o /work/docker/mysql/conf/my.cnf 'https://gitee.com/yujianbode/shell/raw/master/my.cnf'

read -p "请输入数据库的root密码：" password

docker run -p 3306:3306  \
--name mysql_8 \
--privileged=true \
--restart=always \
-v /work/docker/mysql/log:/var/log/mysql \
-v /work/docker/mysql/data:/var/lib/mysql \
-v /work/docker/mysql/conf:/etc/mysql/conf.d \
-v /etc/localtime:/etc/localtime:ro \
-e MYSQL_ROOT_PASSWORD=$password \
-d mysql:latest

echo '进入容器完成后，手动完成后续步骤……'
#进入容器
docker exec -it mysql_8 /bin/bash
